<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>3WCoffee咖啡馆签到</title>
        <link href="css/sp/css.css" rel="stylesheet" type="text/css" />
        <script>
            var welcomeUrl = "${baseUrl}";
			var req;
            
            function callback(){
                document.getElementById("content").style.display = "none";
                document.getElementById("checkin").style.display = "block";
            }
            
            function onSuccess(position){
                alert('Latitude: ' + position.coords.latitude + '\n' +
                      'Longitude: ' + position.coords.longitude + '\n' +
                      'Accuracy: ' + position.coords.accuracy + '\n');
                
                var lat = position.coords.latitude;
                var lng = position.coords.longitude;
                var acy = position.coords.accuracy;
                var url = "${baseUrl}/ajax.sf?lng=" + lng + "&lat=" + lat + "&acy=" + acy;
                
                if (typeof XMLHttpRequest != "undefined") {
                    req = new XMLHttpRequest();
                } else if (window.ActiveXObject) {
                    req = new ActiveXObject("Microsoft.XMLHTTP");
                }
				
                req.open("GET", url, true);
                req.onreadystatechange = callback;
                req.send(null);
            }
			
            function onError(error){
                alert('获取GPS位置信息失败。');
                self.location = welcomeUrl;
            }
            
            function checkLocation(){
                document.getElementById("checkin").style.display = "none";
                
                if (!navigator.geolocation) {
                    alert("抱歉您的手机或者您使用的浏览器不支持定位功能，不能签到。请使用具有GPS定位功能的iPhone、iPad或者Android手机，并确认是用手机自带的标准浏览器访问本页面进行签到。");
                    self.location = welcomeUrl;
                }
                else {                    
                    navigator.geolocation.getCurrentPosition(onSuccess, onError);
                }
            }
        </script>
    </head>
    <body onload="checkLocation()">
        <div class="logo">
            <img src="images/sp/logo.jpg" alt="logo" width="320" height="75" />
        </div>
        <div class="nav_bar">
            <a href="${baseUrl}" class="link12lv">&lt; 返回</a>
        </div>
        <div class="tab">
            <span class="zi18hui">签到方式</span>
        </div>
        <div id="checkin">
            <div class="show_info">
                <div class="show_txt2">
                    <img src="images/sp/tengxun.gif" hspace="5" align="absbottom" /><span class="zi18hui"><a href="oareq.sf?host=qq" class="link18hui">腾讯微博</a></span>
                </div>
            </div>
            <div class="show_info">
                <div class="show_txt2">
                    <img src="images/sp/sina_logo.gif" width="28" height="28" hspace="5" align="absbottom" /><span class="zi18hui"><a href="oareq.sf?host=sina" class="link18hui">新浪微博</a></span>
                </div>
            </div>
        </div>
        <div id="content" class="show_info">
            <span><img class="pic-loading" src="images/loading.gif" alt="Get Browser Geolocation"/>正在获得您的位置信息...</span>
        </div>
        <div class="hui_bar">
        </div>
    </body>
</html>
